package ospedale.main;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * 
 * @author giusepperestivo
 *
 */
public class Test01 {

	public static void main(String[] args) {
		
		String PATHNAME="data/file.txt";
		File file=new File(PATHNAME);
		
		if (!file.exists()) {
			System.err.println("Il file "+PATHNAME+" NON esiste. Creazione...");
			try {
				file.createNewFile();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}else {
			System.err.println("File "+PATHNAME+" aperto con successo.");
		}
		
		try {
			BufferedReader bReader=new BufferedReader(new FileReader(file));
			String line=bReader.readLine();
			while(line!=null){
				System.err.println(line);
				line=bReader.readLine();
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		

	}

}
